package com.Map集合;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/*
Map集合遍历方式二
 */
public class MapDemo05 {
/*结果
001,张飞
002,关羽
003,曹操

 */
    public static void main(String[] args) {
        Map<String, String> hashMap = new HashMap<>();

        //添加方法 是put
        hashMap.put("001","张飞");
        hashMap.put("002","关羽");
        hashMap.put("003","曹操");


        Set<Map.Entry<String, String>> entries = hashMap.entrySet();
        for (Map.Entry<String, String> entry : entries) {
            String key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key+","+value);
        }

    }
}
